			<div>
				<ul class="breadcrumb">
					<li>
						<a href="<?php echo site_url("menu/survey");?>">Quản lý khảo sát</a> / 
						<a href="<?php echo site_url("surveytype");?>">Loại khảo sát</a> / 
						<?php echo $st->survey_type_name;?>
					</li>
				</ul>
			</div>
			<div class="row-fluid">
				<div class="box span12">
					<div class="box-header well">
						<h2><i class="icon-list-alt"></i> Phiếu khảo sát</h2>
						<div class="box-icon">
							<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
						</div>
					</div>
					<div class="box-content">
						<table class="table">
							  <thead>
								  <tr>
									  <th>Tên phiếu Khảo sát</th>
									  <th></th>
								  </tr>
							  </thead>   
							  <tbody>
								  <?php foreach($slist as $s){?>
                                <tr>
									<td><?php echo $s->survey_name;?></td>
									<td class="right">
										<a class="btn btn-success" href="<?php echo site_url("survey/details/".$s->survey_id);?>">
											<i class="icon-zoom-in icon-white"></i>  
											Xem
										</a>
										<?php if($s->status =='2'){?>
											<a class="btn btn-info btn-setting" href="#notifyeditModal" sname="<?php echo $s->survey_name;?>">
												<i class="icon-edit icon-white"></i> Sửa
											</a>
										<?php }else{?>
											<a class="btn btn-info" href="<?php echo site_url("survey/edit_step1/".$s->survey_id);?>">
												<i class="icon-edit icon-white"></i> Sửa
											</a>
										<?php };?>
										<a class="btn btn-danger btn-setting" href="#deleteModal" 
											sid="<?php echo $s->survey_id;?>" sname="<?php echo $s->survey_name;?>">
											<i class="icon-trash icon-white"></i> 
											Xoá
										</a>
									</td>
								</tr>
                                <?php }?>
							  </tbody>
						 </table>
					</div>
					<div>
						<div class="form-actions">
							<a class="btn btn-primary" href="<?php echo site_url("survey/create_step1");?>"> Tạo phiếu khảo sát</a>
						</div>
					</div>
				</div><!--/span-->
            </div>
    <!-- Hidden dialog -->     
        <!-- Popup delete survey -->
		<div class="modal hide fade" id="deleteModal">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h3>Xóa phiếu khảo sát</h3>
				</div>
                <!-- <form class="form-horizontal"> -->
                <form class="form-horizontal" method="post">
    				<div class="modal-body">
    					<fieldset>
    						<div class="control-group">
                                Bạn có chấp nhận xoá phiếu khảo sát <b><span id="dsname"></span></b> không?
                                <input id="dsid" name="sid" type="hidden"/>
    						</div>
    					</fieldset>
    				</div>
    				<div class="modal-footer">
    					<a href="#" class="btn" data-dismiss="modal">Thoát</a>
    					<button type="submit" name="submit" value="delete" class="btn btn-primary">Đồng ý</button>
    				</div>
                </form>
			<!-- </form> -->
		</div>
        <!-- Popup notify can't delete survey -->
		<div class="modal hide fade" id="notifyModal">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h3>Không thể xóa phiếu khảo sát</h3>
				</div>
    				<div class="modal-body">
    					<fieldset>
    						<div class="control-group">
                                Đã tồn tại dữ liệu khảo sát thuộc phiếu <b><span id="nsname"></span></b>.
    						</div>
    					</fieldset>
    				</div>
    				<div class="modal-footer">
    					<a href="#" class="btn" data-dismiss="modal">Thoát</a>
    				</div>
		</div>
<!-- Popup notify can't edit survey -->
		<div class="modal hide fade" id="notifyeditModal">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h3>Không thể sửa phiếu khảo sát</h3>
				</div>
    				<div class="modal-body">
    					<fieldset>
    						<div class="control-group">
                                Phiếu khảo sát <b><span id="nesname"></span></b> đã được đóng.
    						</div>
    					</fieldset>
    				</div>
    				<div class="modal-footer">
    					<a href="#" class="btn" data-dismiss="modal">Thoát</a>
    				</div>
		</div>
        <!-- Popup notify can't connect to server -->
		<div class="modal hide fade" id="errorModal">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h3>Error!!!</h3>
				</div>
    				<div class="modal-body">
    					<fieldset>
    						<div class="control-group">
                                Lỗi kết nối đến máy chủ.
    						</div>
    					</fieldset>
    				</div>
    				<div class="modal-footer">
    					<a href="#" class="btn" data-dismiss="modal">Thoát</a>
    				</div>
		</div>
    <!-- Placed at the end of the document so the pages load faster -->
    <!-- Internal Script -->
    <script type="text/javascript">
        $(document).ready(function(){
            //Event of button Delete Stype
            $('a[href="#deleteModal"]').click(function(){
                var sid = $(this).attr("sid");
                var sname = $(this).attr("sname");
                //Check whether stype can be deleted
                $.get("<?php echo base_url();?>survey/check_delete/" + sid,function(data, result){
					if(result == "success"){
						if(data == true){
							$("#dsid").val(sid);
							$("#dsname").html(sname);
							$("#deleteModal").modal('show');
						}
						else if(data == false){
							$("#nsname").html(sname);
							$("#notifyModal").modal('show');
						}
					}else
						$("#errorModal").modal('show');
                });
            });
			//Event of button edit Survey
            $('a[href="#notifyeditModal"]').click(function(){
                var sname = $(this).attr("sname");
                //Check whether Survey can be deleted
				$("#nesname").html(sname);
				$("#notifyeditModal").modal('show');
            });
        });
    </script>
    <!-- End Internal Script -->